package com.flying.function;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.Message;

import java.util.function.Function;

@SpringBootApplication
public class FunctionApplication {

    public static void main(String[] args) {
        SpringApplication.run(FunctionApplication.class, args);
    }

    @Bean
    public Function<Message<String>, String> uppercase() {
        return FunctionLib.uppercase();
    }

    @Bean
    public Function<Message<String>, String> lowercase() {
        return msg -> msg.getPayload().toLowerCase();
    }
}